#ifndef _LOG_H_
#define _LOG_H_
#include <string>
using namespace std;

namespace Zen{namespace utility{

#define LOG_MAX_SIZE 1*1024*1024

class LogFile;

class simple_log
{
public:
	simple_log(const string& name = "");

	~simple_log();

	bool OpenLog();

	void CloseLog();

	const char *GetLogName();

	int GetLogSize();

	LogFile* GetLogFile();

	void operator()(const char *fmt, ...);

private:
	// log file object, for handle the log
	LogFile *gLogFile;
	// log file index, update on each OpenLog call
	unsigned long gLogIndex;
	// current log file name, update on each OpenLog call
	char gLogName[MAX_PATH];

	string name_;
};

#ifdef SIMPLE_LOG
extern simple_log _glog;
#define LOG _glog
#endif

}}
#endif // _LOG_H_